
function Database() {
	// We temporarily re-install each time
	if(Ti.App.Properties.getString('notFirstApplicationStart') == true) {
		var existingDatabase = Titanium.Database.open('fuelerDB');
		//if(existingDatabase && firstTime) {
		// REMOVED existingDatabase.remove(); // We can remove this for production versions
		//existingDatabase.remove(); 
		//firstTime = false;
		//return Ti.Database.install('/database/fuelerDB.db', 'fuelerDB');
		return existingDatabase;
	} else {

		var self = Ti.Database.install('/database/fuelerDB.db', 'fuelerDB');
	
		return self;
	}
}

var firstTime = true;

module.exports = Database;
